Repository navigation
fix(plugin-grid): ask row Edit/Delete verdicts when the row actions are first used, not on first paint - #34227
Merged
Merged
Conversation
…t used, not on first paint Claude-Session: https://claude.ai/code/session_01ADHkmRSP3ZjQXiwomqs6D6 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmRSP3ZjQXiwomqs6D6 Co-authored-by: Claude <noreply@anthropic.com>
…eset Claude-Session: https://claude.ai/code/session_01ADHkmRSP3ZjQXiwomqs6D6 Co-authored-by: Claude <noreply@anthropic.com>
…ions first Claude-Session: https://claude.ai/code/session_01ADHkmRSP3ZjQXiwomqs6D6 Co-authored-by: Claude <noreply@anthropic.com>
… no ref written in render Claude-Session: https://claude.ai/code/session_01ADHkmRSP3ZjQXiwomqs6D6 Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
|
domain:ui#2 · os-steve · session_01ADHkmRSP3ZjQXiwomqs6D6 Test UI (2/16) is red on head 10b3d34 with exactly the 8 cases of Stamped 2026-11-16T02:07Z. Generated by Claude Code |
…n its rows arrive Claude-Session: https://claude.ai/code/session_01ADHkmRSP3ZjQXiwomqs6D6 Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
|
domain:ui#2 · os-steve · session_01ADHkmSzhXR4yUAgwq1bQRi 维护者速读
席位意见推迟到第一次用到行操作再问,是不改协议前提下最大的收益:每个列表首屏少两次重请求。剩下的「两次合成一次」需要协议改动,应该单独开卡,不在这里硬塞。同意落地。 席位核对 — ACCEPT · domain:ui#2 · head 1ca52c3 · 2026-11-16T05:19Z |
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Steve · project thread
Fixes #34208
Clause-②: no
Metadata-protocol: none
ui/packages/plugin-grid/src/ObjectGrid.tsxcarries one added line (the hook call gainsupdateOnMount: inlineEditable,), added after #34213 merged (main 31eb2ae merged into this branch).维护者速读
POST /api/v1/security/explain;用户第一次触及某行的操作(鼠标或焦点到操作格、打开「⋮」或右键菜单)时,整页一次性按操作各发一批。update。首次使用发 2 次(update、delete 各一),卡上验收写「至多一次」,合成一次要改 spec 与服务端,不在本卡。回滚即 revert 本 PR。ui/packages/plugin-grid/src/hooks/useRecordCrudVerdicts.ts(demanded与toAskFor)、ui/packages/plugin-grid/src/components/RowActionMenu.tsx(触发点与verdictPending)、ui/packages/plugin-grid/src/ObjectGrid.tsx(updateOnMount: inlineEditable一行)。pnpm --dir ui exec vitest run packages/plugin-grid/src/__tests__/rowRecordCrudVerdict.test.tsx,预期 22/22 通过,其中[objectstack#34208]一组 7 条。What changes
useRecordCrudVerdictsasks nothing until a row-action surface callsrequestVerdicts()(now carried on the returned lookup, besidepending). The first call asks once for the page, one batch per operation under the server's cap; later calls are free. Once asked, the list keeps its verdicts current as before (a new page, a data change re-asks the changed rows). Before the first ask, verdicts the module cache already holds are still published, and a data change asks nothing.updateOnMountasksupdatewhen the rows arrive, for a surface that reads it while rendering. The inline-editable cells (objectstack#27365) are that surface;ObjectGrid.tsxpassesupdateOnMount: inlineEditable.RowActionMenugains two optional props.onActionsDemandis called on pointer-enter and focus of the actions cell, when the "⋮" opens, and whenRowActionMenuItemsmounts, which covers the row context menu too (it renders the same items).crudVerdictPendingrenders the built-in Edit or Delete as disabled witharia-busywhile that row's answer is on the wire, so it cannot be clicked into a write the answer is about to refuse.objectGridActionsColumn.tsxwires both from the hook's lookup into the props both menus read.update, onedelete), both lazily, on the first use only; zero at first paint; a second row's menu sends nothing. One request for both operations needsoperations: [...]on the explain route, a spec and server change outside this card.content/docs/frontend/plugins/plugin-grid.mdxsay when the verdict is asked.Tests
New pins in
rowRecordCrudVerdict.test.tsx, a top-leveldescribe('[objectstack#34208] …')in the existing harness:Forced test edits (each now reaches for the row actions, or asks through a helper, before reading a verdict; no assertion changed meaning):
rowRecordCrudVerdict.test.tsx: the existing pins call a newreachRowActions()(hover the first "⋮") beforesettle(N); the pre-answer-window pin reaches before its held answer.serverGroupedVerdictProbe-32627.test.tsx: both pins assert zero asks after the groups settle, then reach for the first row's "⋮" and count the same two requests over every row.hooks/useRecordCrudVerdicts.{afterAction-13341,batchCap,invalidation,principalScope}.test.tsx: render the hook through the new__tests__/askedRecordCrudVerdicts.tshelper, which callsrequestVerdicts()on mount.inlineEditRecordVerdict-27365.test.tsx: its 8 existing cases are unchanged (they were red on this branch until theObjectGrid.tsxline landed, which is what they guard); a new top-leveldescribe('[objectstack#34208] …')pins that an inline-editable grid's first paint asksupdatefor the page and nothing else, and that opening a kebab then asksdeleteonce.Acceptance notes
editable: true, opt-in) will still send one explain request (update) after their rows arrive, because their cells read it while rendering.Verification
Final head
1ca52c3e(main 31eb2ae merged; install and the@object-ui/plugin-grid^...closure rebuilt after the merge).Local runs on 1ca52c3
pnpm --dir ui exec vitest run packages/plugin-grid/— Test Files 283 passed (283), Tests 2458 passed (2458); lock VERDICT command-exit 0.pnpm --filter @object-ui/plugin-grid type-check— exit 0.Ablations (ablation-replace, restore proven by blob == HEAD)
const toAskFor = demandedreplaced with an always-true condition): 7 red, including "the first paint of a list with rows sends no explain request".const disabled = verdictPending || (withfalse): 1 red, "opening a row's ⋮ asks once for the page … the open menu narrows to the answer".updateOnMount: inlineEditablereplaced withfalse(on 1ca52c3): 9 red, every case ofinlineEditRecordVerdict-27365.test.tsxincluding the new first-paint pin.Derived gates
node scripts/pm/dispatch-gates.mjs --commandson 1ca52c3: 71 families, every one exit 0.--ran: 71 derived, 71 run, 0 NOT-MEASURED, 0 UNRUN.🤖 Generated with Claude Code
https://claude.ai/code/session_01ADHkmRSP3ZjQXiwomqs6D6